<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="点击"/>
<script>
    function Observer(){
        this.listen=function(eventName,fn) {
            this.addEventListener(eventName,fn);
        };
        this.trigger=function(eventName,p1){
            p1.listen(eventName,fn);
        };
        this.remove=function(eventName,fn){
            eventName.removeEventListener(eventName,fn);
        }
    }
    var o=new Observer();
    o.listen("click",p);
    //o.trigger("click",o);
    function p(){
        alert(1);
    }

</script>
</body>
</html>